﻿using System;
using System.Collections.Generic;
using Autodesk.Revit.DB;

namespace RegionSplittor.Utils.InternalCorner
{
	public class PointUtils
	{
		public static List<XYZ> GetMaxDistTwoPoints(List<XYZ> lstPoint)
		{
			List<XYZ> list = new List<XYZ>();
			XYZ xyz = null;
			XYZ xyz2 = null;
			double num = double.MinValue;
			foreach (XYZ xyz3 in lstPoint)
			{
				foreach (XYZ xyz4 in lstPoint)
				{
					double num2 = xyz3.DistanceTo(xyz4);
					if (num2 > num)
					{
						xyz = xyz3;
						xyz2 = xyz4;
						num = num2;
					}
				}
			}
			if (xyz != null && xyz2 != null)
			{
				list = new List<XYZ>();
				list.Add(xyz);
				list.Add(xyz2);
			}
			return list;
		}

		public static XYZ GetMaxDistToPoint(List<XYZ> lstPoint, XYZ ptCmp)
		{
			XYZ result = null;
			double num = double.MinValue;
			foreach (XYZ xyz in lstPoint)
			{
				double num2 = xyz.DistanceTo(ptCmp);
				if (num2 > num)
				{
					num = num2;
					result = xyz;
				}
			}
			return result;
		}
	}
}
